package com.ronin.managed.bean;


import com.ronin.commmon.beans.util.JsfUtil;
import com.ronin.model.Firma;
import com.ronin.service.IFirmaService;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import org.apache.log4j.Logger;

@ManagedBean(name = "firmaMB")
@ViewScoped
public class FirmaMB implements Serializable {
public static Logger logger = Logger.getLogger(FirmaMB.class);

    @ManagedProperty("#{firmaService}")
    private IFirmaService firmaService;

    private Firma seleceted;
    private List<Firma> list;

    @PostConstruct
    public void init() {

    }

    public void add(Firma firma) {
        try {
            firmaService.add(firma);
        } catch (Exception e) {
            logger.error(e.getStackTrace());
            JsfUtil.addSuccessMessage("Hata!");
        }
        JsfUtil.addSuccessMessage("?slem basarili");

    }

    public void update(Firma firma) {
        try {
            firmaService.update(firma);
        } catch (Exception e) {
            logger.error(e.getStackTrace());
            JsfUtil.addSuccessMessage("Hata!");
        }
        JsfUtil.addSuccessMessage("?slem basarili");
    }

    public void delete(Firma firma) {
        try {
            firmaService.update(firma);
        } catch (Exception e) {
            logger.error(e.getStackTrace());
            JsfUtil.addSuccessMessage("Hata!");
        }
        JsfUtil.addSuccessMessage("?slem basarili");
    }

}
